
<%var csstpl = {%>
<link href="${basepath}/vendor/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<style>
	* { outline:none; }
	li { list-style:none; }
	.hide { display:none; }
	.clear { clear:both; margin:0; }
	a{color: #337ab7!important;text-decoration: none!important;}
	.content { position:relative; margin-bottom:20px; padding:15px; background:#fff; border: 1px solid #e7eaec; border-radius:3px; }

	.processer { border:1px solid #eee; margin-bottom:15px; }
	.processer .contt { position:relative; margin:0 100px; padding:70px 0; }
	.processer .contt > div { position:relative; }
	.processer .line { position:absolute; top:50%; width:100%; border-top:1px dashed #999; }
	.processer .steps { position:absolute; top:-50px; width:140px; margin-left:-70px; text-align:center; border:0px solid #10A64F; }
	.processer .steps p { font:16px/25px "微软雅黑"; }
	.processer .steps b { display:block; width:30px; height:30px; margin:auto; font:16px/30px "微软雅黑"; color:#fff; text-align:center; background:#ddd; border-radius:50%; }
	.processer .steps i { font:13px/35px "微软雅黑"; color:#ccc; }
	.processer .steps.active p { color:#10A64F; }
	.processer .steps.active b { background:#10A64F; }
	.processer .steps.step1 { left:0; }
	.processer .steps.step2 { left:33%; }
	.processer .steps.step3 { left:66%; }
	.processer .steps.step4 { left:100%; }

	.order { margin:15px 0; border: 1px solid #eee; }
	.order_info { padding:15px; border-right: 1px solid #eee; }
	.order_opt  { padding:15px; }
	.order h2 { font:16px/22px "微软雅黑"; color:#444; margin:0 0 15px; }
	.order ul { padding:0; }
	.order li { position:relative; padding:5px 0 5px 70px; color:#999; }
	.order span { position:absolute; left:0; display:block; width:70px; color:#777; text-align:right; }
	.order p { margin:0; }
	.order b { font:13px/16px "微软雅黑"; margin-bottom:10px; }
	.order a { margin-left:8px;}
	.order .btn_express { margin-left:0; }
	.order .btn { position:absolute; right:20px; bottom:20px; padding:3px 15px; }

	table { width:100%; margin-top:15px; }
	table td2 { padding:20px; background:#f8f8f8; border: 2px solid #fff; vertical-align:top; }
	/* table tbody { margin:10px 0; border:1px solid #F8F8F8; } */
	table tbody tr.title { border:1px solid #e7eaec; }
	table tbody tr.title td { padding:12px; background:#f8f8f8; vertical-align:top; }
	table tbody tr.sep { height:10px; }
	table tbody tr.remark { border:1px solid #e7eaec; }
	table tbody tr.remark td { padding:10px; color:#999; text-align:right; }
	table tbody tr.remark td b { color:#55BD47; }
	table tbody tr.info { border:1px solid #e7eaec; background:#F8F8F8; }
	table tbody tr.info td { padding:10px; }
	table tbody tr.detail { padding-top:10px; }
	table tbody tr.detail td { padding:12px; vertical-align:top; border:1px solid #e7eaec; }
	table tbody tr.detail td b { font-weight:normal; margin-right:8px; }
	table tbody tr.detail td .btn { font:13px/20px "微软雅黑"; margin-right:5px; padding:3px 20px; background:#ffffff; color:#333; border:1px solid #ddd; }
	table tbody tr.detail td.td1 img { float:left; width:80px; margin-right:12px; }
	table tbody tr.detail td.td1 .name { font:14px/1.5em "微软雅黑"; margin-bottom:8px; display:block; }
	table tbody tr.detail td.td1 p { font:14px/1.5em "微软雅黑"; color:#999; margin:0; }
	table tbody tr.detail td.td2 { width:10%; text-align:center; }
	table tbody tr.detail td.td3 { width:10%; text-align:center; }
	table tbody tr.detail td.td4 { width:10%; text-align:center; }
	table tbody tr.detail td.td5 { width:10%; text-align:center; }
	table tbody tr.detail td.td6 { width:10%; text-align:center; }

	.send_contt { display:none; }
	.send_panel div.bind { position:relative; padding-left:60px; margin-bottom:10px; }
	.send_panel div.bind label { position:absolute; left:0; font:14px/35px "微软雅黑"; }
	.send_panel div.bind input { display:block; width:100%; padding:5px; border:1px solid #e5e5e5; border-radius:3px; font:14px/20px "微软雅黑"; }
	.send_panel div.bind select { display:block; width:100%; padding:5px; border:1px solid #e5e5e5; border-radius:3px; font:14px/20px "微软雅黑"; }

	.addr_contt { display:none; }
	.addr_panel div.bind { position:relative; padding-left:40px; margin-bottom:10px; }
	.addr_panel div.bind label { position:absolute; left:0; font:14px/35px "微软雅黑"; }
	.addr_panel div.bind input { display:block; width:100%; padding:5px; border:1px solid #e5e5e5; border-radius:3px; font:14px/20px "微软雅黑"; }
	.new-info { color:#1ab394; }
	.layui-layer-btn .layui-layer-btn0{color: #FFF !important;}
</style>
<%};%>
<%var jstpl = {%>
<script>
	//$(document).ready(function(){$("#loading-example-btn").click(function(){btn=$(this);simpleLoad(btn,true);simpleLoad(btn,false)})});function simpleLoad(btn,state){if(state){btn.children().addClass("fa-spin");btn.contents().last().replaceWith(" Loading")}else{setTimeout(function(){btn.children().removeClass("fa-spin");btn.contents().last().replaceWith(" Refresh")},2000)}};
	$(".btn-save").click(function(){
		var url ="/system/order/edit/edit_sku?item_id="+$("input[name='modal_itemId']").val()+"&sku_id="+$("#sku_data_list").val();
		gx.ajax(url,function(d){
			if(d.state){
				window.location.reload();
			}else{
				gx.alert(d.msg);
			}
		})
	})
	// 修改规格
	$(".btn_sku").on("click",function(){
		var  sku_id=  $(this).data("skuid");
		var  productid=  $(this).data("productid");
		var itemid= $(this).data("itemid");
		$("input[name='modal_itemId']").val(itemid);
		gx.ajax("/system/order/edit/sku_list/"+productid,function(d){
			$("#sku_data_list").empty();
			for(var i=0;i<d.data.length;i++){
				if(d.data[i].sku_id==sku_id){
					$("#sku_data_list").append("<option selected value='"+d.data[i].sku_id+"'>"+d.data[i].sku_text+"</option>");
				}else{
					$("#sku_data_list").append("<option value='"+d.data[i].sku_id+"'>"+d.data[i].sku_text+"</option>");
				}
			}
			$('#myModal_c').modal('show')

		})
	});

</script>
<script src="${basepath}/vendor/script/Ajax.web.1.0.3.js"></script>
<script src="/static/vendor/script/order.js?v=a1812"></script>
<%};%>
<%layout("../layout/_layout_mall.html",{title:'小金娱',jstpl:jstpl,csstpl:csstpl}){ %>

<div class="wrapper wrapper-content animated fadeInUp">
	<div class="content">

		<!-- 存储order_id -->
		<input type="hidden"  id="orderId" value="${order.id!}">
		<div class="processer">
			<div class="contt">
				<p class="line"></p>
				<div>
					<%if(order.type==2){%>
					<% if(order.state==0){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==1){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==2){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3 active"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==3){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3 active"><p>商家发货</p><b>3</b></div>
					<div class="steps step4 active"><p>订单完成</p><b>4</b></div>
					<%  } else if(order.state==4){ %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3 active"><p>已经退款</p><b>3</b></div>
					<%  } else if(order.state==6){ %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3 active"><p>申请退款</p><b>3</b></div>
					<%  }else{  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active">
					<%if(order.is_presale_state==1){%>
						<p>待付订金</p><b>2</b>
					<%}else if(order.is_presale_state==2){%>
						<p>已付定金</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}else if(order.is_presale_state==3){%>
						<p>待付尾款</p><b>2</b>
					<%}else if(order.is_presale_state==4){%>
						<p>已付尾款</p><b>2</b><i>${order.time,"yyyy-MM-dd HH:mm:ss"}</i>
					<%}%>
					</div>
					<div class="steps step3 active"><p>${@AppConst.Procuct_State.get(order.state+'')}</p><b>3</b><i>未知</i></div>
					<%  }  %>
					<%}else{%>
					<% if(order.state==0){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 "><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==1){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==2){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3 active"><p>商家发货</p><b>3</b></div>
					<div class="steps step4"><p>订单完成</p><b>4</b></div>
					<%  }else if(order.state==3){  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3 active"><p>商家发货</p><b>3</b></div>
					<div class="steps step4 active"><p>订单完成</p><b>4</b></div>
					<%  } else if(order.state==4){ %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3 active"><p>已经退款</p><b>3</b></div>
					<%  } else if(order.state==6){ %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3 active"><p>申请退款</p><b>3</b></div>
					<%  }else{  %>
					<div class="steps step1 active"><p>买家下单</p><b>1</b><i>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step2 active"><p>买家付款</p><b>2</b><i>${order.pay_time,"yyyy-MM-dd HH:mm:ss"}</i></div>
					<div class="steps step3 active"><p>${@AppConst.Procuct_State.get(order.state+'')}</p><b>3</b><i>未知</i></div>
					<%  }  %>
					<%}%>

					<!-- <div class="steps step1 active"><p>买家下单</p><b>1</b><i>2016-06-21 15:34:56</i></div>
                    <div class="steps step2 active"><p>买家付款</p><b>2</b><i>2016-06-21 15:34:56</i></div>
                    <div class="steps step3"><p>商家发货</p><b>3</b></div>
                    <div class="steps step4"><p>订单结算</p><b>4</b></div> -->

				</div>
			</div>
		</div>

		<div class="order row">
			<div class="order_info col-md-6">
				<h2>订单信息</h2>
				<ul>
					<!--  <%if(order.interface_state!=0){%>
                     <li style="background-color: #ddd"><span>拼团状态：</span><p><small class="label label-primary">${@AppConst.Pdd_Interface_State.get(order.interface_state!)}</small></p></li>
                     <li style="background-color: #ddd"><span>下单号码：</span><p>${order.interface_phone!'none'} </p></li>
                     <li style="background-color: #ddd"><span>订单状态：</span><p>${order.interface_oder_id!'无'}</p></li>
                        <li style="background-color: #ddd"><span>成本价格：</span><p>${order.interface_price!'none'}
                     <a target="_blank" href="http://sc.yangkeduo.com/chat_detail.html?mall_id=${item_list[0].source_mall_id!}&goods_id=${item_list[0].source_product_id}&refer_page_name=goods_detail"  class="btn  btn-outline btn-primary ">联系客服</a></p></li>
                     <%}%> -->
					<li><span>订单类型：</span><p><small class="label label-warning">${@AppConst.Product_Attr_Type.get(order.type+'')}</small></p></li>
					<li><span>状态：</span><code>${@AppConst.Procuct_State.get(order.state+'')}</code></li>
					<li><span>订单编号：</span><p>${order.id!}</p></li>
					<li><span>下单时间：</span><p>${order.createtime,"yyyy-MM-dd HH:mm:ss"}</p></li>
					<li><span>订单总额：</span><p>
						<small class="label label-primary"> ￥ ${order.total_amount!0}</small>
						商品金额  :<small class="label label-primary"> ￥ ${order.item_amount!}</small> ,
						运费:<small class="label label-primary"> ￥ ${order.express_amount!}</small></p></li>
					<!-- <li><span>结算金额：</span><p>分销金额(${order.fx_amount!})+	分销返回(${order.fx_back_amount!}) - 支付手续费(${order.jy_amount!})</p></li> -->
					<li><span>优惠金额：</span><p><small class="label label-primary"> ￥ ${order.preferentialAmount!0}</small>    </p></li>
					<li><span>结算总额：</span><p><small class="label label-primary"> ￥ ${order.js_amount!0}</small>    </p></li>
					<li><span>付款方式：</span><p>${@AppConst.Pay_Type.get(order.pay_type)}</p></li>
					<li><span>支付时间：</span><p>${order.pay_time!'未支付'}</p></li>
					<li style="display: none;"><span>订单ID：</span><p>${order.interface_oder_id!} </p></li>
					<li><span>收货信息：</span><p>${order.express_address!'无'}  ${order.express_receive_name!'无'}（${order.express_phone!}）  <a href="javascript:;" class="btn_addr2">修改</a> </p> </li>
					<!-- <span>买家留言：</span><p>如果可以，麻烦使用百世汇通快递！谢谢！</p>
                    <span>商家备注：</span><b>这个订单加急！</b><a href="javascript:;" class="btn_renark2">备注</a> -->
					<li><span>买家留言：</span>
						<%  if (order.user_remarks==null || order.user_remarks==''){  %>
						<p>无</p></li>
					<%  } else{ %>
					<p>${order.user_remarks!}</p></li>
					<% }   %>
					<li><span>商家备注：</span><b  id="remark">${order.admin_remark!'无'}</b><a href="javascript:;" data-remark="${order.admin_remark!}" class="btn_renark2">备注</a></li>

				</ul>
				<%if(order.type==1){%>
					<%  if(order.state==1 ){  %>
					<a  id="btn${order.id}" class="btn btn_send2 btn-outline btn-primary ">发货</a>
					<%  }  %>
				<%}else{%>
					<%if(order.state==1  && order.is_presale_state==4){%>
						<a  id="btn${order.id}" class="btn btn_send2 btn-outline btn-primary ">发货</a>
					<%}%>
				<%}%>
			</div>
			<div class="order_opt col-md-6">
				<h2>物流信息</h2>
				<ul>
					<%  if(order.supply_type==1){   %>
					<li><span>供应类型：</span><p>自营</p></li>
					<%  }else if(order.supply_type==2){  %>
					<li><span>供应类型：</span><p>供应商</p></li>
					<li><span>供应单位：</span><p>${order.master_name!}</p></li>
					<%  }  %>
					<%if(order.express_no!=null){%>
					<li><span>收货人：</span><p>${order.express_receive_name!}</p></li>
					<li><span>收货电话：</span><p>${order.express_phone!}</p></li>
					<li><span>快递单号：</span><p>${order.express_no!'暂时未发货'}</p></li>
					<li><span>配送快递：</span><p> ${@AppConst.Express.get(order.express_name)}  <a href="javascript:;"  id="btn${order.id}" data-sendtype="change" class="btn_send2">修改物流单号</a></p></li>
					<li><span>发货时间：</span><p>${order.express_time!'暂时未发货'}</p></li>
					<li><span>收货信息：</span><b>${order.express_address!}, ${order.express_receive_name!}, ${order.express_phone!}</b><a href="javascript:;" class="btn_addr2">修改</a></li>
					<li><span>物流详情：</span><a class="btn_express express_search"  data-id="${order.id}"  data-express-time="${order.express_time,"yyyy-MM-dd HH:mm:ss"}"  data-express-name="${order.express_name}"  data-express-no="${order.express_no}">查看物流信息</a></li>
					<%}else{%>
					<li><span>物流类型：</span><p>
						<%if(order.express_name=='ziti'){%>
						自提  <a href="javascript:;"  id="btn${order.id}" data-sendtype="change" class="btn_send2">修改物流单号</a>
						<%}else{%>暂无物流信息<%}%>
					</p></li>
					<%}%>
				</ul>
			</div>
		</div>

		<div class="addr_contt">
			<div class="bind">
				<label>地址</label>
				<input type="text" class="addr" placeholder="请输入" data-value="${order.express_address!}" />
			</div>
			<div class="bind">
				<label>买家</label>
				<input type="text" class="buyer" placeholder="请输入" data-value="${order.express_receive_name!}" />
			</div>
			<div class="bind">
				<label>手机</label>
				<input type="text" class="phone" placeholder="请输入" data-value="${order.express_phone!}" maxlength="11" />
			</div>
		</div>

		<!--  <table>
         <tbody>
         <tr class="title">
           <td class="td1">商品</td>
           <td class="td2">单价（元）</td>
           <td class="td3">数量（件）</td>
           <td class="td4">优惠（元）</td>
           <td class="td5">运费（元）</td>
           <td class="td6">小计（元）</td>
         </tr>
         <tr class="detail">
           <td class="td1">
           <img src="/static/vendor/img/a1.jpg" />
           <a href="javascript:;" class="name">枕被两用创意靠枕</a>
           <p><b>颜色：红色，尺寸：M</b><a href="javascript:;" class="btn_sku">修改</a></p>
           </td>
           <td class="td2"><p>68.00</p></td>
           <td class="td3"><p>1</p></td>
           <td class="td4"><p>-</p><a href="javascript:;" class="btn_price">修改</a></td>
           <td class="td5">包邮</td>
           <td class="td6">68.00</td>
         </tr>
         <tr class="remark"><td colspan="6">买家付款：<b>129.00</b></td></tr>
         </tbody>
         </table> -->

		<table>
			<tbody  data-id="${order.id!}">
			<tr class="title">
				<td class="td1">商品</td>
				<td class="td2">单价（元）</td>
				<td class="td3">数量（件）</td>
				<!--  <td class="td4">优惠（元）</td> -->
				<td calss="td4">小计(元)</td>
				<td class="td4">状态</td>
				<td class="td5">运费（元）</td>
				<td class="td6">总金额（元）</td>
			</tr>

			<!-- 遍历订单开始 -->
			<% for(item in item_list ){  %>

			<% if(itemLP.first) {  %>
			<tr class="detail">
				<td class="td1"  data-id="${item.item_id!}">
					<img src="${item.image_center!}?imageView2/1/w/200/h/200" />
					<a href="javascript:;" class="name">${item.product_name!}</a>
					<p><b>${item.sku_text!}</b>
						<%  if(isNotEmpty(item.sku_text )){  %>
						<a href="javascript:;" class="btn_sku" data-itemid="${item.item_id!}" data-skuid="${item.sku_id!}" data-productid="${item.product_id!}">修改</a>
						<% }  %>

					</p>
				</td>
				<td class="td2">
					<%  if(isNotEmpty(item.unit_price))  {  %>
					<p>${item.unit_price!0}</p>
					<%  }else {  %>
					<p>${item.price!0}</p>
					<%  }  %>
				</td>
				<td class="td3"><p>${item.nums!0}</p></td>
				<!--  <td class="td4" rowspan="${item_list.~size!}">
                  <%  if(isNotEmpty(order.change_amount))  {  %>
                 <p>${order.change_amount!0}</p>
                 <%  }else {  %>
                 <p>0</p>
                 <%  }  %>
                 <p>${order.change_amount!0}</p>
                  <% if(order.state==0){  %>
                 <a href="javascript:;" class="btn_price">修改</a>

                 </td>
                 <%  }   %> -->

				<td class="td4">
					<b class="sum_price">${item.unit_price*item.nums!0}</b>
					<%if(item.refund_state==1&&order.pay_state==2&&order.state!=3&&order.state!=5){%>
					<p><a href="javascript:;"  onclick="activeRefund(${item.item_id!},${item.unit_price*item.nums!0},${order.express_amount!0},'${item.product_name!}','${item.sku_text!}')">主动退款</a></p>
					<%}else if(item.refund_state==5&&item.refund!=null){%>
					<%if(item.refund.is_active_refund==1){%>
					<p>商家主动退款</p>
					<%}%>
					<%}%>
				</td>

				<td class="td4"><b><%if(item.refund_state!=1){%>${item.refund_state_name}<%}%></b></td>
				<td class="td5" rowspan="${item_list.~size!}">
					<p>${order.express_amount!0}</p>
					<% if(order.state==0){  %>
					<a href="javascript:;" class="btn_postFee">修改</a></td>
				<%  }   %>
				</td>
				<!-- fang  2016-07-21  增加  -->
				<!-- fang  2016-08-22  修改   积分  -->

				<td class="td6" rowspan="${item_list.~size!}"><b class="sum_price">${order.total_amount!0}</b></td>

			</tr>

			<% }else{  %>
			<tr class="detail">
				<td class="td1" data-id="${item.item_id!}">
					<img src="${item.image_center!}?imageView2/1/w/200/h/200" />
					<a href="javascript:;" class="name">${item.product_name!}</a>
					<%  if(isNotEmpty(item.sku_text))  {  %>
					<p><b>${item.sku_text!}</b><a href="javascript:;" class="btn_sku" data-itemid="${item.item_id!}" data-skuid="${item.sku_id!}" data-productid="${item.product_id!}">修改</a></p>
					<%  }  %>
				</td>
				<td class="td2">

					<%  if(isNotEmpty(item.unit_price))  {  %>
					<p>${item.unit_price!0}</p>
					<%  }else {  %>
					<p>${item.price!0}</p>
					<%  }  %>

				</td>
				<td class="td3"><p>${item.nums!0}</p></td>

				<td class="td4">
					<b class="sum_price">${item.unit_price*item.nums!0}</b>
					<%if(item.refund_state==1&&order.pay_state==2&&order.state!=3&&order.state!=5){%>
					<p><a href="javascript:;"  onclick="activeRefund(${item.item_id!},${item.unit_price*item.nums!0},${order.express_amount!0},'${item.product_name!}','${item.sku_text!}')">主动退款</a></p>
					<%}else if(item.refund_state==5&&item.refund!=null){%>
					<%if(item.refund.is_active_refund==1){%>
					<p>商家主动退款${item.refund.refund_fee/100}${item.refund.is_add_freight==1?'(含运费)':''}</p>
					<%}%>
					<%}%>
				</td>
				<td class="td4"><b><%if(item.refund_state!=1){%>${item.refund_state_name}<%}%></b></td>
			</tr>
			<%  }  %>

			<%  }  %>
			<tr class="remark">
				<td colspan="7">买家付款：
					<%  if(order.pay_state!null==0){  %>
					<b>未付款</b>
					<%}else if(order.pay_state!null==1){%>
					<b>尚未付款</b>
					<%}else if(order.pay_state!null==2){%>
					<b>支付成功</b>
					<%}else if(order.pay_state!null==3){%>
					<b>已退款</b>
					<%}else if(order.pay_state!null==4){%>
					<b>支付超时</b>
					<%}%>
				</td></tr>
			</tbody>
		</table>

		<div class="send_contt">
			<div class="bind">
				<label>选快递</label>
				<select onchange="selExpress(this)">
					<option value="">请选择</option>
					<%  for(express in @AppConst.Express){  %>
					<option value="${express.key!}">${express.value!}</option>
					<%  }  %>
				</select>
			</div>
			<div class="bind">
				<label>订单号</label>
				<input type="text" placeholder="请输入" />
			</div>

		</div>

	</div>
</div>

<!-- 物流查询 -->
<!-- Modal_a -->
<div class="modal fade" id="myModal_a" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog modal-md" role="document" style="min-width:800px">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">物流详情</h4>
			</div>
			<div class="modal-body row">
				<table class="table">
					<thead>
					<tr>
						<th width="150px">时间</th>
						<th>内容</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<td colspan="2" style="text-align:center"><h2>暂无数据</h2></td>
					</tr>
					</tbody>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default btn-close" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>

<!-- 主动退款 -->
<!-- Modal_b -->
<div class="modal fade" id="myModal_b" tabindex="-1" role="dialog">
	<div class="modal-dialog modal-md" role="document" style="min-width:800px">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">主动退款</h4>
			</div>
			<div class="modal-body row">
				<input type="hidden" name="modal_itemId" />
				<input type="hidden" name="modal_amount" />
				<input type="hidden" name="isAddFreight">

				<table class="table">
					<thead>
					<tr>
						<th>商品</th>
						<th>退款金额(元)</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<td><p><a href="javascript:;" class="modal_product_name"></a></p><p class="modal_product_sku">商品规格</p></td>
						<td><p class="modal_amount">2</p></td>
					</tr>
					</tbody>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-success" onclick="refundSubmit()">提交</button>
				<button type="button" class="btn btn-default btn-close" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>

<!-- 修改SKU -->
<div class="modal fade" id="myModal_c" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog modal-md" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">修改商品的SKU</h4>
			</div>
			<div class="modal-body row">
				<div class="col-md-12 col-xs-12">
					<div class="col-md-2 col-xs-5">
						<p class="row">sku：</p>
					</div>
					<div class="col-md-10 col-xs-7">
						<p class="row express_name">
							<select  id="sku_data_list" class="form-control m-b">

							</select>
						</p>
					</div>
				</div>

			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-success btn-save" >修改</button>
				<button type="button" class="btn btn-default btn-close" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>

<%}%>

<script>

	//主动退款弹层
	function activeRefund(itemId,amount,expressAmount,name,sku){
		$.ajax({
			url: "/system/order/isPreferential?itemId="+itemId,
			async: false,
			success: function(d) {
				if(d.state){
					amount=amount-d.data;
				}
			}
		})

		Ajax("/system/order/isAddFreight?itemId="+itemId, function(d) {
			$(".modal_product_name").html(name);
			$(".modal_product_sku").html(sku);
			$("input[name='modal_itemId']").val(itemId);
			if(d.state){
				if(d.data){
					$(".modal_amount").html(amount+expressAmount+"(含运费:"+expressAmount+")");
					$("input[name='modal_amount']").val(amount+expressAmount);
					$("input[name='isAddFreight']").val(1);
					$("#myModal_b").modal('show');
				}else{
					$(".modal_amount").html(amount);
					$("input[name='modal_amount']").val(amount);
					$("input[name='isAddFreight']").val(0);
					$("#myModal_b").modal('show');
				}
			}else{
				layer.msg(d.msg);
			}
		})
	}

	function refundSubmit(){
		var itemId = $("input[name='modal_itemId']").val();
		var amount = $("input[name='modal_amount']").val();
		var isAddFreight=$("input[name='isAddFreight']").val();
		var orderId = $("#orderId").val();
		Ajax("/system/order/activeRefund?itemId="+itemId+"&orderId="+orderId+"&price="+amount+"&isAddFreight="+isAddFreight, function(d) {
			if(d.state){
				$("#myModal_b").modal('hide');
				layer.msg(d.msg);
				window.location.reload();
			}else{
				layer.msg(d.msg);
			}
		})
	}

	function selExpress(_this){
		if($(_this).val()=="ziti"){
			$(_this).parent().next().find("input").val("");
			$(_this).parent().next().hide();
		}
	}

	$(".express_search").click(function(){
		var order_id = $(this).data("id");
		gx.ajax("/system/order/order_express?order_id="+order_id,function(ret){
			if(ret.state){
				var html = "";
				var content = JSON.parse(ret.data.content);
				if(content.length!=0){
					for(i in content){
						html += "<tr><td>"+content[i].time+"</td><td>"+content[i].context+"</td></tr>";
					}
				}else{
					html = "<tr><td colspan='2' style='text-align:center'><h2>暂无数据</h2></td></tr>";
				}
				$("#myModal_a tbody").html(html);
				$('#myModal_a').modal('show');
			}else{
				layer.msg(ret.msg);
			}
		})
		/* var express_name=$(this).attr("data-express-name");
        var express_no=$(this).attr("data-express-no");
        var express_code  ="";
        if(express_name.indexOf("申通")!=-1){
            express_code  =  "shentong";
        }else if(express_name.indexOf("韵达")!=-1){
            express_code  =  "yunda";
        }
        var express_no=$(this).attr("data-express-no");

        gx.iframeindex=layer.open({
            type: 2,
            title: "快递查看",
            shadeClose: true,
            shade: false,
            maxmin: false,
            shade: 0.8,
            area: ['375px ','627px'],
            content: "http://m.kuaidi100.com/index_all.html?type="+express_code+"&postid="+express_no+"&callbackurl=http://mall.ab-union.cn/wx/about"
        });  */
	})


	//物流   方    2016-06-28
	$(".express_search1").click(function(){
		//取得订单号
		var order_id=$(this).attr("data-id");
		var express_name=$(this).attr("data-express-name");
		var express_no=$(this).attr("data-express-no");
		var express_time=$(this).attr("data-express-time");
		$(".express_name").text(express_name);
		$(".express_no").text(express_no);
		$(".express_time").text(express_time);
		$(".notice_express").text(express_time);
		$.ajax({
			cache : true,
			type : "post",
			url : "/api/express",
			data:{"order_id":order_id},
			//data:$('#static_table').serialize(),
			//data:{"service":service,"team_category":team_category,"people_num":people_num,"district_id":district_id},// 你的formid
			async : false,
			error : function(request) {
				alert("Connection error");
			},
			success : function(d) {
				//console.info(d);
				//console.info(JSON.parse(d.content));
				//layer.msg("请求成功成功!");
				var gettpl = $("#detail").html();
				laytpl(gettpl).render(JSON.parse(d.content), function(html) {
					$('#tbody_body').html(html);
				});
				//弹框
				$('#myModal_a').modal('show');
			}
		});
	})




</script>

<script id="detail" type="text/html">
	{{# for(var i = 0, len = d.length; i < len; i++){ }}
	{{#  if(i==d.length-1){    }}
	<li class="col-md-12 col-xs-12 new-info">
		<div class="col-md-3 col-xs-5">
			<p class="row">{{d[i].time}}</p>
		</div>
		<div class="col-md-9 col-xs-7">
			<p class="row">{{d[i].content}}</p>
		</div>
	</li>
	{{# }else{   }}
	<li class="col-md-12 col-xs-12 ">
		<div class="col-md-3 col-xs-5">
			<p class="row">{{d[i].time}}</p>
		</div>
		<div class="col-md-9 col-xs-7">
			<p class="row">{{d[i].content}}</p>
		</div>
	</li>
	{{#  }  }}
	{{# } }}

</script>